package main

import "fmt"

func main() {
	//ScoreGrade()
	getMonthDays()
}

func ScoreGrade(){
	grade := "A"
	switch grade {
	case "A":
		fmt.Println("优秀")
	case "B":
		fmt.Println("良好")
	case "C":
		fmt.Println("中等")
	case "D":
		fmt.Println("及格")
	default:
		fmt.Println("不及格")
	}
}

func testTrue(){
	switch  {
	case true:
		fmt.Println("true")
	case false:
		fmt.Println("false")
	}
}

func ScoreGrade2(){
	score:=78.5
	grade := ""
	switch {
	case score>=90:
		grade  = "A"
	case score>=80:
		grade  = "B"
	case score>=70:
		grade  = "C"
	case score >=60:
		grade  = "D"
	default:
		grade  = "E"
	}
	fmt.Println("grade---"+grade)
}

func getMonthDays()  {
	year := 2008
	month := 2
	days := 0

	switch month {
	case 1,3,5,7,8,10,12:
		days = 31
	case 4,6,9,11:
		days = 30
	case 2:
		if (year%4 == 0 && year %100!=0)||year%400==0{
			days=29
		}else {
			days=28
		}
	default:
		days=-1
	}

	fmt.Printf("%d年%d月的天数为：%d",year,month,days)
}
